package controller

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type Response struct {
	Code ResCode        `json:"code"`
	Msg  interface{} 	`json:"msg"`
	Data interface{} 	`json:"data"`
}

func ResponseError(c *gin.Context, code ResCode) {
	c.JSON(http.StatusOK,&Response{
		Code: code,
		Msg: code.GetMsg(),
		Data:nil,
	})
}
func ResponseErrorWidthMsg(c *gin.Context, code ResCode, msg interface{}) {
	c.JSON(http.StatusOK,&Response{
		Code: code,
		Msg: msg,
		Data:nil,
	})
}
func ResponseSuccess(c *gin.Context, data interface{}) {
	c.JSON(http.StatusOK,&Response{
		Code: CodeSuccess,
		Msg: CodeSuccess.GetMsg(),
		Data: data,
	})
}